Skip to content

[RemoveLayoutConversions]: Reduce loop carried values #4915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

etiotto
Copy link
Contributor

@etiotto etiotto commented Aug 18, 2025

This PR implements an optimization to reduce loop carried values in the RemoveLayoutConversions pass by reusing equivalent loop results with layout conversion operations instead of carrying redundant values through loops.

Fixes issue #4901

@etiotto etiotto self-assigned this Aug 18, 2025
@etiotto etiotto requested a review from Copilot August 18, 2025 22:41
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements an optimization to reduce loop carried values in the RemoveLayoutConversions pass by reusing equivalent loop results with layout conversion operations instead of carrying redundant values through loops.

  • Adds logic to identify and replace redundant loop arguments with equivalent ones plus layout conversions
  • Handles LoadOp and StoreOp operations that use these loop results
  • Reduces memory usage and improves loop efficiency by eliminating unnecessary loop-carried tensor pointer values

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
RemoveLayoutConversions.cpp Implements the core optimization logic to reduce loop carried values by replacing redundant arguments with conversions
backward_combine_dpas_dot_layout.mlir Adds test case to verify the optimization works correctly for tensor pointer operations in loops

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@etiotto etiotto changed the title [RemoveLAyoutConversions]: Reduce loop carried values [RemoveLayoutConversions]: Reduce loop carried values Aug 19, 2025
Signed-off-by: Tiotto, Ettore <[email protected]>
@etiotto etiotto marked this pull request as ready for review August 19, 2025 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RemoveLayoutConversions]: Rematerialization increases loop carried values in loop
1 participant